<?php
require_once("database.php");
class xl_employer extends database
{
	function danh_sach($vi_tri, $so_luong)
	{
		$vi_tri = intval($vi_tri);
		$so_luong = intval($so_luong);
		$sql = "select * from employer limit $vi_tri, $so_luong";
		$this->setQuery($sql);
		return $this->loadAllRow();
	}
	function so_luong()
	{
		$sql = "select count(*) from employer";
		$this->setQuery($sql);
		return $this->loadResult();
	}
	function xem($epid)
	{
		
		$sql = "select * from employer where epid = '$epid'";
		$this->setQuery($sql);
		return $this->loadRow();
	}
	function xoa($epid)
	{
		
		$sql = "delete from employer where epid = '$epid'";
		$this->setQuery($sql);
		$this->query();
	}
	function them($epname)
	{
		$epname = addslashes($epname);

		$sql = "INSERT INTO employer(epname) VALUES ('$epname')";
		$this->setQuery($sql);
		return $this->query();
	}
	function cap_nhat($epid, $epname)
	{
		$epname = addslashes($epname);

		$sql ="UPDATE employer SET epname= '$epname' WHERE epid = '$epid'";
		$this->setQuery($sql);
		return $this->query();
	}
	function tim_kiem ($tu_khoa)
	{
		$sql = "select * from employer where	$epname like %tu_khoa%"; 
		$this->setQuery($sql);
		return $this->loadAllRow();	
	}
 }
?>